package com.wx.tnsadmin.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wx.tnsadmin.mapper.LogMapper;
import com.wx.tnsadmin.pojo.SysLog;
import com.wx.tnsadmin.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;


/**
 * @Author:LLH
 * @Date:2020/8/19
 */
@Service
public class LogServiceImpl implements LogService {
    @Autowired
    private LogMapper logMapper;


    @Override
    public Integer save ( SysLog log ) {
        return logMapper.save ( log );
    }

    @Override
    public PageInfo findByLogPage ( SysLog log ) {
        PageHelper.startPage ( log.getPageNum ( ),log.getPageSize ( ) );
        List<SysLog> byLogPage = logMapper.findByLogPage ( log );
        PageInfo pageInfo = new PageInfo ( byLogPage );
        return pageInfo;

    }

    @Override
    public Integer deleteLogById ( String id ) {
        return logMapper.deleteLogById ( id );
    }

    @Override
    public Integer batchLogDelete ( List<String> id ) {
        HashMap<String, List<String>> map = new HashMap<> ( );
        map.put ( "id",id );
        return logMapper.batchLogDelete ( map );
    }

    @Override
    public List<SysLog> findByKeyWord ( SysLog log ) {
        return logMapper.findByKeyWord ( log );
    }


}
